/************************************************
 * Author       :   XXY
 * Blog         :   https://www.cnblogs.com/jzyl
 * Gitee        :   https://gitee.com/xiaobaichong
 * Email        :   1047185209@QQ.com
 * FileName     :   Singleton.cs
 * CreateData   :   2023/5/8 17:25:45
 * UnityVersion :   2021.3.20f1c1
 * Description  :   单例模板类
************************************************/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;

namespace Hotfix
{
    /// <summary>
    /// 单例模板类
    /// </summary>
    internal class Singleton<T> where T : class
    {
        private static T instance;

        public static T Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = Utility.CreateInstance<T>();
                }
                return instance;
            }
        }

        protected Singleton()
        {
            // 私有构造函数
        }
    }
}
